package com.zq.assistant.ui;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.Nullable;

import java.util.ArrayList;

/**
 * Created by zhangqiang on 17-6-12.
 */

public class TestActivity extends BaseActivity{

    private int[] test ;

    private String str1  ;
    private String str2 ;
    private String str3 ;
    private int sex = 2;
    private float a;
    private double b;
    private short c;
    private ArrayList<Parcelable> list;
    private Bundle data;

    public static void start(Context context, int[] test, String str1, String str2, String str3, int sex, float a, double b, short c, ArrayList<Parcelable> list, Bundle data) {

        Intent intent = new Intent(context, TestActivity.class);
        intent.putExtra("test", test);
        intent.putExtra("str1", str1);
        intent.putExtra("str2", str2);
        intent.putExtra("str3", str3);
        intent.putExtra("sex", sex);
        intent.putExtra("a", a);
        intent.putExtra("b", b);
        intent.putExtra("c", c);
        intent.putParcelableArrayListExtra("list", list);
        intent.putExtra("data", data);
        context.startActivity(intent);
    }


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initStartParams(savedInstanceState);
    }


    private void initStartParams(Bundle savedInstanceState) {
        if (savedInstanceState == null) {
            this.test = getIntent().getIntArrayExtra("test");
            this.str1 = getIntent().getStringExtra("str1");
            this.str2 = getIntent().getStringExtra("str2");
            this.str3 = getIntent().getStringExtra("str3");
            this.sex = getIntent().getIntExtra("sex", 2);
            this.a = getIntent().getFloatExtra("a", 0);
            this.b = getIntent().getDoubleExtra("b", 0);
            this.c = getIntent().getShortExtra("c", (short) 0);
            this.list = getIntent().getParcelableArrayListExtra("list");
            this.data = getIntent().getParcelableExtra("data");
        }
    }
}
